package day22.edu;

import java.util.ArrayList;
import java.util.Scanner;

// Created: 22/09/2025, ChangJiang Ru
public class StudentTest {
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        ArrayList arrayList = new ArrayList();

        while(true)
        {
            System.out.println("Please input thr information of student: ");
            System.out.println("1: Continue input, 0: End input");
            int selection = scan.nextInt();

            if (selection == 0)
            {
                break;
            }

            System.out.print("Please input the name of student: ");
            String name = scan.next();
            System.out.print("Please input the age of Student: ");
            int age = scan.nextInt();

            Student student = new Student(name, age);
            arrayList.add(student);
        }

        System.out.println("Traverse the information of student:");
        for(Object s : arrayList)
        {
            Student stu = (Student)s;
            System.out.println(stu.toString());
        }

        scan.close();
    }
}
